/******************************************************************************************
*                                                                                         *    
*                              Developed by Bruno Pires                                   *
*                                                                                         *
*                             email: bruno@blastersystems.com                             *
*                               web: www.blastersystems.com                               *
*                              blog: www.blastersystems.com/blog                          *
*                           twitter: brunoacpires                                         *
*                                                                                         *
*                      Software available under GNU LGPL License                          *
*                                                                                         *    
* *****************************************************************************************/

using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace DataValidatorTests
{
    using DataValidator;
    
    [TestClass]
    public class ValidaDadosTest
    {
        public ValidaDadosTest()
        {
            //
            // TODO: Add constructor logic here
            //
        }

        #region Additional test attributes
        //
        // You can use the following additional attributes as you write your tests:
        //
        // Use ClassInitialize to run code before running the first test in the class
        // [ClassInitialize()]
        // public static void MyClassInitialize(TestContext testContext) { }
        //
        // Use ClassCleanup to run code after all tests in a class have run
        // [ClassCleanup()]
        // public static void MyClassCleanup() { }
        //
        // Use TestInitialize to run code before running each test 
        // [TestInitialize()]
        // public void MyTestInitialize() { }
        //
        // Use TestCleanup to run code after each test has run
        // [TestCleanup()]
        // public void MyTestCleanup() { }
        //
        #endregion

        [TestMethod]
        public void ValidaNibTest()
        {
            string nib = " 0781 0112 0000000 7784 96";

            Assert.IsTrue(ValidaDados.ValidaNib(nib));
        }

        [TestMethod]
        public void ValidaIban()
        {
            string iban = "DE89370400440532013000";
            Assert.IsTrue(ValidaDados.ValidaIban(iban));
        }

        [TestMethod()]
        public void ValidaNif()
        {
            string nif = "108094049";
            Assert.IsTrue(ValidaDados.ValidaNif(nif));
        }

        [TestMethod()]
        public void ValidaBi()
        {
            //8074662-4
            //1569448-8
            string nbi = "8074662";
            string nbiCheckDigit = "4";
            string nbi2 = "1569448";
            string nbiCheckDigit2 = "8";

            Assert.IsTrue(ValidaDados.ValidaBi(nbi, nbiCheckDigit));
            Assert.IsTrue(ValidaDados.ValidaBi(nbi2, nbiCheckDigit2));
        }

        [TestMethod()]
        public void ValidaMorada()
        {
            var valida = new ValidaDados();
            //Assert.IsNull(valida.ValidaMorada(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, "1250-142", string.Empty, string.Empty).TipoErro);
            Assert.IsNull(valida.ValidaMorada(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, "5370-127", string.Empty, string.Empty).TipoErro);

        }
    }
}
